<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Notices extends Model
{
    public static function getNotice($user,$limit)
    {
        return self::with(['detail'=>function($query) use($user){
            $query->where('users_id',$user);
        }])->order('id','desc')
            ->paginate($limit);
    }

    public function detail()
    {
        return $this->hasOne(NoticesUsers::class,'notice_id','id');
    }
}
